﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ClassCourseCalendar.aspx.cs"
    Inherits="Manager_ClassCourseCalendar" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Css/ext-all.css">
    <link type="text/css" rel="stylesheet" href="../Css/ys.css">

    <script type="text/javascript" src="../Js/jquery-1.4.2.min.js"></script>

    <script type="text/javascript" src="../Js/Ext/ext-base.js"></script>

    <script type="text/javascript" src="../Js/Ext/ext-all.js"></script>

    <script type="text/javascript" src="../Js/Core.js"></script>

    <script type="text/javascript" src="../Js/Main.js"></script>

    <script type="text/javascript">
        var sl;
        Ext.onReady(function() {

            InitSilder("Init");

        });
        function InitSilder(t) {
          
            if (t == "Init") {
                sl = new Ext.Slider({
                    renderTo: 'scroll',
                    width: 266,
                    minValue: 0,
                    maxValue: 1200,
                    values: [0, 1200],
                    clickToChange: false,
                    plugins: new Ext.slider.Tip({
                        getText: function(thumb) {

                            var fen = 0;
                            var miao = 0;
                            if (parseInt(thumb.value / 60) < 10) {
                                fen = "0" + parseInt(thumb.value / 60);
                            } else {
                                fen = parseInt(thumb.value / 60);
                            }
                            if (Math.round(thumb.value % 60) < 10) {
                                miao = "0" + Math.round(thumb.value % 60);
                            }
                            else {
                                miao = Math.round(thumb.value % 60);
                            }
                            var startTime = fen + ":" + miao;

                            return String.format('{0}', startTime);
                        }

                    }),
                    listeners: {
                        'changecomplete': function(slider, newValue, thumb) {
                            var left = slider.getValues();

                            var min = left[0];
                            var max = left[1];
                            
                            var baseWidth = 266 / 1200;
                            var leftWidth = min * baseWidth;
                            var rightWidth = (max - min) * baseWidth;
                            $("#divHtml").remove();
                            var html = "<div id='divHtml' class='x-slider-bg' style=\"position:absolute; left:" + leftWidth + "px; width:" + rightWidth + "px; \"></div>";
                            $("#ext-gen4").append(html);
                            var startTime = ConvertFen(min) + ":" + ConverMiao(min);
                            var endTime = ConvertFen(max) + ":" + ConverMiao(max);
                            $("#SStartTime").val(startTime);
                            $("#SEndTime").val(endTime);

                        }

                    }
                });
            } else {
                ResetSilder();
            
            }
        }
        function ResetSilder() {


            if (sl != undefined) {
                sl.setValue(0, 0, true);
                sl.setValue(1, 1200, true);
            }
            var min = 0;
            var max = 1200;
            var baseWidth = 266 / 1200;
            var leftWidth = min * baseWidth;
            var rightWidth = (max - min) * baseWidth;
            $("#divHtml").remove();
            var html = "<div id='divHtml' class='x-slider-bg' style=\"position:absolute; left:" + leftWidth + "px; width:" + rightWidth + "px; \"></div>";
            $("#ext-gen4").append(html);
        
         };
        
        
        function ConvertFen(time) {
            if (parseInt(time / 60) < 10) {
                fen = "0" + parseInt(time / 60);
            } else {
                fen = parseInt(time / 60);
            }
            return fen;

        }
        function ConverMiao(time) {
            if (Math.round(time % 60) < 10) {
                miao = "0" + Math.round(time % 60);
            }
            else {
                miao = Math.round(time % 60);
            }
            return miao;
        }
        $(document).ready(function() {
            $("#classInfo").hide();


        });
        function VideoPalyByIndex(index) {

            $("[DataField='CurrentIndex']").val(index);
            VideoNetSchool.Calendar.LoadClass(index, $("[DataField='CourselistID']").val(), $("[DataField='CourseDate']").val(), $("[DataField='RoomId']").val(), $("[DataField='StartTime']").val(), $("[DataField='EndTime']").val());
        }

        function VideoPlay(listId, date, roomId, startTime, endTime) {
            $("[DataField='CourselistID']").val(listId);
            $("[DataField='CourseDate']").val(date);
            $("[DataField='RoomId']").val(roomId);
            $("[DataField='StartTime']").val(startTime);
            $("[DataField='EndTime']").val(endTime);
            VideoNetSchool.Calendar.LoadClass(0, listId, date, roomId, startTime, endTime);

        }

        function SwitchTab(liIndex, showId) {
            $("#rdMonth").hide();
            $("#rdWeek").hide();
            $("#rdClass").hide();
            $("#" + showId).show();
            $("#tabUl").find("li").each(function() { $(this).removeClass(); });
            var li = $("#tabUl").find("li:eq(" + liIndex + ")"); //.addClass("LiHover");
            li.addClass("on");

        }



        function LoadPlayer(filePath, imgPath, vSid) {

            $("#vSid").val(vSid);
            ResetTime();
            InitSilder();
            var flashvars = {
                file: filePath,
                type: 'http',
                image: imgPath,
                autostart: 'false',
                streamer: 'start'
              
            };
            var params = {
                allowfullscreen: 'true',
                allowscriptaccess: 'always',
                wmode:'opaque'
            };
            var attributes = {
                id: 'player',
                name: 'player'
            };
            swfobject.embedSWF('../plugin/flvplayer.swf', 'container', '450', '280', '9.0.115', false, flashvars, params, attributes);
        }
        $(function() {
            var height = 0;
            for (i = 0; i < $('.course_up').length; i++) {
                if ($('.course_up').eq(i).height() > height) {
                    height = $('.course_up').eq(i).height();
                }
            }
            $(".course_up").height(height);
            $("#rdWeek").hide();
        });
        function resetHeight() {
            var height = 0;
            for (i = 0; i < $('.course_up').length; i++) {
                if ($('.course_up').eq(i).height() > height) {
                    height = $('.course_up').eq(i).height();
                }
            }

            $(".course_up").height(height);
        }
        
        

        function SetTime(slider,value) {
            var reg = /([0-2][0]:[0][0])|([0-1][0-9]:[0-5][0-9])/;
            var result = reg.exec(value);
            if (result != null) {
                var fen = value.split(":");
                var len = parseInt(fen[0] * 60) + parseInt(fen[1]);
                if (sl != undefined) {
                    sl.setValue(slider, len, true);
                }
                $("#btnSubmit").removeAttr("disabled");
            } else {
                alert("对不起，请输入正确的时间格式，比如：11:00!");
                $("#btnSubmit").attr("disabled", "disabled");
                return;
            }
        }
        function ResetTime() {
            ResetSilder();
            $("#SStartTime").val("00:00");
            $("#SEndTime").val("20:00");
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="mainCenter">
        <div class="contentBody">
            <div class="title">
                学校管理--&gt;修改学校信息</div>
            <div class="video_edit">
                <div class="video_l">
                    <%--<div class="video_main">
                        <embed src="../Plugin/loading.swf" type="application/x-shockwave-flash" allowscriptaccess="always"
                            allowfullscreen="true" wmode="opaque" width="450" height="280"></embed>
                    </div>
                    --%>
                    <div class="video_main" id="v">
                        <div id="container">
                        </div>
                        <span id="spanPlayer">
                            <embed src="../Plugin/loading.swf" type="application/x-shockwave-flash" allowscriptaccess="always"
                                allowfullscreen="true" wmode="opaque" width="450" height="280"></embed>
                        </span>
                    </div>
                    <div class="video_edit_main">
                        <div class="video_edit_l">
                       编辑区
                            </div>
                        <div class="video_edit_c">
                            <div id="scroll">
                            </div>
                        </div>
                        <div class="video_edit_r">
                            <a href="javascript:" onclick="ResetTime();">重置</a></div>
                        <div class="video_form">
                            <span>开始时间：</span><input id="SStartTime" type="text" value="00:00" datafield="SStartTime"   onblur="SetTime(0,this.value);"/><span>结束时间：</span><input
                                type="text" id="SEndTime" value="20:00"  datafield="SEndTime" onblur="SetTime(1,this.value);" /><input name="" type="button" onclick="VideoNetSchool.Calendar.Submit();" style="cursor:pointer"
                                    class="video_edit_bt" id="btnSubmit"/><div id="loading" style="display:none">数据提交中，请等待...</div>
                                    <input id="vSid" type="hidden" />
                                    </div>
                                    
                    </div>
                </div>
                <div class="video_r1">
                    <h3>
                     当前班级：<asp:Literal ID="ltrClass" runat="server"></asp:Literal>  </h3>
                    <p>
                  当前时间：<span id="spTime">暂无</span><span>课程名称：<span id="CourseName">请选择课程</span></span><span>主讲师：<span id="TeacherName">暂无</span></span></p>
                    <ul>
                        <span id="Player"></span>
                    </ul>
                </div>
                <div class="video_r2">
                    <div class="video_edit_scl">
                        <a href="javascript:" onclick='$("#allCourse").show(500);'>请选择班级切换</a>
                    </div>
                    <div class="video_kb">
                        <div class="kb">
                            <div class="item">
                                <h3>
                                    <ul id="tabUl">
                                        <li class="on"><a href="javascript:SwitchTab(0,'rdMonth')">按月</a></li>
                                        <li><a href="javascript:SwitchTab(1,'rdWeek')">按周</a></li>
                                        <li><a href="javascript:SwitchTab(2,'rdClass')">按课程</a></li>
                                    </ul>
                                </h3>
                                <div class="kb_c" id="rdMonth">
                                    <div class="main_calendar layout">
                                        <div style="display: inline; float: left; margin-left: 5px">
                                            <div class="date_new">
                                                公元
                                                <asp:DropDownList ID="caleyear" runat="server" class="year" AutoPostBack="true" OnSelectedIndexChanged="Calendar_SelectedIndexChanged">
                                                    <asp:ListItem Value="2010">2010</asp:ListItem>
                                                    <asp:ListItem Value="2011">2011</asp:ListItem>
                                                    <asp:ListItem Value="2012">2012</asp:ListItem>
                                                    <asp:ListItem Value="2013">2013</asp:ListItem>
                                                    <asp:ListItem Value="2014">2014</asp:ListItem>
                                                    <asp:ListItem Value="2015">2015</asp:ListItem>
                                                    <asp:ListItem Value="2016">2016</asp:ListItem>
                                                    <asp:ListItem Value="2017">2017</asp:ListItem>
                                                    <asp:ListItem Value="2018">2018</asp:ListItem>
                                                    <asp:ListItem Value="2019">2019</asp:ListItem>
                                                    <asp:ListItem Value="2020">2020</asp:ListItem>
                                                </asp:DropDownList>
                                                <asp:DropDownList ID="calemon" runat="server" AutoPostBack="true" class="riqi" OnSelectedIndexChanged="Calendar_SelectedIndexChanged">
                                                    <asp:ListItem Value="1">1</asp:ListItem>
                                                    <asp:ListItem Value="2">2</asp:ListItem>
                                                    <asp:ListItem Value="3">3</asp:ListItem>
                                                    <asp:ListItem Value="4">4</asp:ListItem>
                                                    <asp:ListItem Value="5">5</asp:ListItem>
                                                    <asp:ListItem Value="6">6</asp:ListItem>
                                                    <asp:ListItem Value="7">7</asp:ListItem>
                                                    <asp:ListItem Value="8">8</asp:ListItem>
                                                    <asp:ListItem Value="9">9</asp:ListItem>
                                                    <asp:ListItem Value="10">10</asp:ListItem>
                                                    <asp:ListItem Value="11">11</asp:ListItem>
                                                    <asp:ListItem Value="12">12</asp:ListItem>
                                                </asp:DropDownList>
                                                月
                                            </div>
                                        </div>
                                        <div id="tableCourseList" runat="server" style="display: inline; float: left; margin-left: 5px">
                                        </div>
                                    </div>
                                </div>
                                <div class="kb_c" id="rdWeek">
                                    <table border="0" id="table01" class="table01" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="pic">
                                                <a href="javascript:" onclick="resetHeight();VideoNetSchool.Calendar.PreWeek();"
                                                    title="上一周">
                                                    <img src="../Images/left.png" alt="上一周" /></a> <a href="javascript:" onclick="resetHeight();VideoNetSchool.Calendar.NextWeek();"
                                                        title="下一周">
                                                        <img src="../Images/right.png" alt="下一周" /></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <table id="table02" class="table02" width="100%" border="0" cellpadding="0" cellspacing="0">
                                                    <span id="spCourseList">
                                                        <asp:Literal ID="CourseList" runat="server"></asp:Literal>
                                                    </span>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="kb_c" id="rdClass" style="display: none">
                                    <div class="kuandu">
                                        <div class="smallbox">
                                            <div class="classform">
                                                <table border="0" cellpadding="0" cellspacing="1">
                                                    <tr>
                                                        <td class="formyangshi1" style="background-color: #dddddd;">
                                                            课程
                                                        </td>
                                                        <td class="formyangshi2" style="background-color: #dddddd;">
                                                            课时
                                                        </td>
                                                        <td class="formyangshi3" style="background-color: #dddddd;">
                                                            课程详细
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <span id="courseTable" runat="server"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="CurrentMinY" runat="server" datafield='CurrentMinY' />
    <input type="hidden" id="CurrentMinMon" runat="server" datafield='CurrentMinMon' />
    <input type="hidden" id="CurrentMinDay" runat="server" datafield='CurrentMinDay' />
    <input type="hidden" id="CurrentMaxY" runat="server" datafield='CurrentMaxY' />
    <input type="hidden" id="CurrentMaxMon" runat="server" datafield='CurrentMaxMon' />
    <input type="hidden" id="CurrentMaxDay" runat="server" datafield='CurrentMaxDay' />
    <input type="hidden" id="hidCurrentIndex" runat="server" datafield='CurrentIndex' />
    <input type="hidden" id="HidCourselistID" runat="server" datafield='CourselistID' />
    <input type="hidden" id="HidRoomId" runat="server" datafield='RoomId' />
    <input type="hidden" id="HidCourseDate" runat="server" datafield='CourseDate' />
    <input type="hidden" id="HidStartTime" runat="server" datafield='StartTime' />
    <input type="hidden" id="HidEndTime" runat="server" datafield='EndTime' />
        <div id="allCourse" style="display: none">
        <div class="home">
            <p style="text-align: right">
                <img style="cursor: pointer" src="../Images/default/qtip/close.gif" onclick="$('#allCourse').hide(500);"></p>
            <ul>
                <asp:Repeater ID="repAllCity" runat="server">
                    <ItemTemplate>
                        <li><a href="?ID=<%#Eval("ID") %>" title="<%#Eval("VTC_name")%>">
                            <%#Eval("VTC_name")%></a></li>
                    </ItemTemplate>
                </asp:Repeater>
                 
            </ul>
        </div>
    </div>
    </form>
</body>
</html>
